<?php
/************************************
*   新浪相册 7.0
*   @file:sysdefine.php
*   @intro:系统基本设置
*   @author:shaopu@
*   @date:Sun Sep 20 17:35:55 CST 2009
************************************/
function rStripslashes($data)
{
    if(is_array($data))
    {
        foreach ($data as $k => $row)
        {
            $data[$k] = rStripslashes($row);
        }
        
        return $data;
    }
    else 
        return stripslashes($data);
}


if(get_magic_quotes_gpc())
{
    $_GET = rStripslashes($_GET);
    $_POST = rStripslashes($_POST);
    $_COOKIE = rStripslashes($_COOKIE);
}




if(!defined('K5_STARTED')){die('withnot global');}
ini_set('display_errors' , 1);
error_reporting(E_ALL ^E_NOTICE);


define('K5_DEBUG' , false);                                      //全局调试开关
define('K5_ENABLE_MC_CACHE' , true);                            //全局CACHE开关
define('K5_ENABLE_FILE_LOG' , true);                           //全局LOG开关
define('K5_ENABLE_LOGINUSER_MC_CACHE' , false);                 //登录用户是否使用CACHE
define('K5_HTTP_TIMEOUT' , 3);                                  //登录用户是否使用CACHE

//各头文件存放目录
define('K5_INCLUDE_PATH' , K5_ROOT.'/__include');               //引用文件根目录
define('K5_LIB_PATH' 	 , K5_INCLUDE_PATH.'/lib');             //常用类库
define('K5_CONFIG_PATH'  , K5_INCLUDE_PATH.'/config');          //参数文件
define('K5_MOD_PATH'     , K5_INCLUDE_PATH.'/data_model');      //数据库模型
define('K5_HELPER_PATH'     , K5_INCLUDE_PATH.'/helper');      //数据库模型
define('K5_APP_PATH'     , K5_INCLUDE_PATH.'/app_model');       //应用模型
define('K5_COMP_PATH'    , K5_INCLUDE_PATH.'/component');       //页面组件
define('K5_LGC_PATH'    , K5_INCLUDE_PATH.'/logic');            //操作逻辑
//后台管理
define('K5_ADMIN_DIR'    , '/__admin');  
define('K5_ADMIN_PATH'    , K5_ROOT.'/__admin');  
define('K5_ADMIN_DATA_DIR' , K5_ADMIN_DIR.'/data');
define('K5_ADMIN_DATA_PATH'    , K5_ADMIN_PATH.'/data');  
//其他常用目录
define('K5_DATA_PATH' , K5_ROOT.'/data');                       //常用数据
define('K5_HTTP_DATA_PATH' , '/data');                       //常用数据
define('K5_UPLOAD_PATH' , K5_DATA_PATH.'/upload');              //日志
define('K5_HTTP_UPLOAD_PATH' , K5_HTTP_DATA_PATH.'/upload');              //日志
define('K5_LOG_PATH' , K5_DATA_PATH.'/log');                    //日志
define('K5_TPL_PATH' , K5_DATA_PATH.'/tpl');                    //模板

//域名
define('K5_ROOT_DOMAIN' , 'www.tailaiantiquefurniture.com');                       //根域名
define('K5_DOMAIN' , 'www.tailaiantiquefurniture.com');                        //相册产品域名
define('K5_PHOTO_ROOT_URL' , 'http://'.K5_DOMAIN);              //根域名
define('K5_MAIL' , 'info@bearsh0p.com');

//LOG相关
define('K5_LOG_SIGN_ERROR' , '[E]');                            //LOG中表示是错误的标识
define('K5_LOG_ALERT_DB' , 'DB');                            //LOG中表示是错误的标识
define('K5_LOG_ALERT_MC' , 'MC');                            //LOG中表示是错误的标识
define('K5_LOG_ALERT_API' , 'API');                            //LOG中表示是错误的标识
define('K5_LOG_ALERT_OTHER' , 'O');                            //LOG中表示是错误的标识

//常用数据值
define('K5_STAT_NORMAL' , 0);       //正常
define('K5_STAT_DELETE' , 2);       //删除

define('K5_SITE_KEYWORD' , '中式家具,古典家具');
define('K5_SITE_DESCRIPTION' , '泰来古典家具');


define('NL' , "\r\n");          //文本换行
define('TAB' , "\t");           //文本分隔



function __autoload($class_name)
{
    $file = K5_INCLUDE_PATH.'/'.$class_name.'.php';
    if(is_file($file))
    {
        include_once($file);
        return ;
    }
    else 
    {
        $prefix = substr($class_name , 0 , strpos($class_name , '_'));
        if($prefix == 'mod')
            include_once(K5_MOD_PATH.'/'.strtolower($class_name).'.php');
        elseif($prefix == 'app')
            include_once(K5_APP_PATH.'/'.strtolower($class_name).'.php');
        elseif($prefix == 'comp')
            include_once(K5_COMP_PATH.'/'.strtolower($class_name).'.php');
        elseif($prefix == 'lib')
            include_once(K5_LIB_PATH.'/'.strtolower($class_name).'.php');
        elseif($prefix == 'helper')
            include_once(K5_HELPER_PATH.'/'.strtolower($class_name).'.php');
        else 
            K::halt('load inexistent class:'.$class_name);
    }
}
?>